
package com.eltonkent.ui.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import com.eltonkent.R;
import com.eltonkent.ui.containers.FolderDetailsContainer;
import com.eltonkent.ui.wrappers.FolderDetailsListWrapper;

public class DialogFolderDetailsListAdapter extends ArrayAdapter<FolderDetailsContainer>
{

	public DialogFolderDetailsListAdapter(Context context, int textViewResourceId,
			FolderDetailsContainer[] objects)
	{
		super(context, textViewResourceId, objects);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		View listView = convertView;
		FolderDetailsListWrapper listWrapper;
		if(listView == null)
		{
			LayoutInflater inflater = LayoutInflater.from(getContext());
			listView = inflater.inflate(R.layout.listview_icon_double_line, parent, false);
			listWrapper = new FolderDetailsListWrapper(listView);
			listView.setTag(listWrapper);
		} else
		{
			listWrapper = (FolderDetailsListWrapper) listView.getTag();
		}
		FolderDetailsContainer listData = getItem(position);
		listWrapper.getLeftText().setText(listData.getLeftString());
		listWrapper.getRightText().setText(listData.getRightString());
		return listView;
	}
}
